#include <stdio.h>
#include <stdlib.h>

typedef struct node_struct
{
    int id;
    int num;
    struct node_struct *next;
} node_t;

int main()
{
    // Begin, Init
    node_t first;
    first.id = 1;

    int number_of_fishes;
    int m;
    scanf("%d%d", &number_of_fishes, &m);

    node_t *ptr = &first;
    scanf("%d",&ptr->num);
    for (int i = 1; i < number_of_fishes; i++)
    {
        ptr->next = (node_t *)malloc(sizeof(node_t));
        ptr = ptr->next;
        ptr->id = i + 1;
        scanf("%d",&ptr->num);
    }
    ptr->next = &first;

    // Begin, Cycle
    node_t* previous = ptr;
    ptr = &first;
    while (number_of_fishes != 1)
    {
        for(int i=1;i<m;i++)
        {
            previous = ptr;
            ptr = ptr->next;
        }
        previous->next = ptr->next;
        m = ptr->num;
        printf("%d ",ptr->id);
        ptr = ptr->next;
        number_of_fishes--;
    }

    printf("%d\n",ptr->id);
    return 0;
}
